# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=commentor
pkgver=20.4582674
pkgrel=1
pkgdesc='Extract all comments from the specified URL resource.'
groups=('blackarch' 'blackarch-webapp' 'blackarch-misc')
arch=('any')
url='https://github.com/D3vil0p3r/comMENTOR'
license=('GPL3')
depends=('curl' 'tidy' 'xmlstarlet')
makedepends=('git')
source=("git+https://github.com/D3vil0p3r/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/share/$pkgname"
  install -dm 755 "$pkgdir/usr/bin"
  install -Dm 755 -t "$pkgdir/usr/share/$pkgname/" "c_cleanup" "c_decorate" \
    "c_filter" "$pkgname"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname/
exec ./$pkgname "\$@"
EOF

  chmod a+x "$pkgdir/usr/bin/$pkgname" \
    "$pkgdir/usr/share/$pkgname/"{c_cleanup,c_decorate,c_filter}
}

